package com.soft.javase.ch04.duotai;

/**
 * @author wangzhisen
 * @Desc TODO
 * @date 2025/4/22
 */
public class Test {

    public static void main(String[] args) {

        System.out.println("-------------Animal--------------");
        Animal animal = new Animal("动物" , "白色" , 1 );
        System.out.println(animal);
        animal.eat(animal);
        Animal.play();

        System.out.println("------------Dog------------");
        Dog dog = new Dog("旺旺" , "土黄色" , 3 , "大黄");
        System.out.println(dog);
        dog.eat(dog);
        dog.kanjia();

        System.out.println("------------Tiger------------");
        Tiger tiger = new Tiger("华南虎" , "白色" , 5);
        System.out.println(tiger);
        tiger.eat(tiger);
        tiger.hunt();

        System.out.println("=================================");
        //父类的引用指向子类的实例   语法: 父类的类型 引用 = new 子类的构造方法();
        Animal a1 = new Dog("柯基" , "棕色" , 2 , "大熊");
        Animal a2 = new Tiger("东北虎" , "花色" , 6);
    }
}
